// 表单验证方法
// ip
export const ipVerify = (rule, value, callback) => {
  if (value === "") {
    callback(new Error("IP地址不能为空"));
  } else {
    const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
    if (reg.test(value)) {
      callback();
    } else {
      callback(new Error("请输入正确的IP地址"));
    }
  }
};
// 邮箱
export const personEmail = (rule, value, callback) => {
  if (value === "") {
    callback(new Error("负责人邮箱不能为空"));
  } else {
    const reg = /^([a-zA-Z0-9]+[\\.])?[a-zA-Z0-9]+@([a-zA-Z0-9]+[\\.]?)[a-zA-Z0-9]+.[a-zA-Z]{2,3}$/;
    if (reg.test(value)) {
      callback();
    } else {
      callback(new Error("请输入正确的邮箱"));
    }
  }
};
// 手机号
export const personPhone = (rule, value, callback) => {
  if (value === "") {
    callback(new Error("负责人手机号不能为空"));
  } else {
    const reg = /^1[3-9][0-9]{9}$/;
    if (reg.test(value)) {
      callback();
    } else {
      callback(new Error("请输入正确的手机号"));
    }
  }
};